<template>
  <div class="divBox">
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <el-form inline size="small">
          <el-form-item label="关键字：">
            <el-input
              v-model="tableFrom.keyword"
               @keyup.enter.native="getList"
              placeholder="请输入姓名/联系电话/邮箱"
              class="selWidth"
              size="small"
            >
              <el-button slot="append" icon="el-icon-search" size="small" class="el-button-solt" @click="getList" />
            </el-input>
          </el-form-item>
        </el-form>
      </div>
      <el-table v-loading="listLoading" :data="tableData.data" style="width: 100%" size="small">
        <!-- <el-table-column prop="talent_id" label="ID" min-width="50" /> -->
        <el-table-column prop="real_name" label="用户姓名" min-width="120" />
        <el-table-column prop="plat" label="平台" min-width="120">
          <template slot-scope="scope">
            <span>{{ scope.row.plat == '其他' ? scope.row.other : scope.row.plat }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="company" label="公司" min-width="150" />
        <el-table-column prop="phone" label="联系电话" min-width="120" />
        <el-table-column prop="email" label="联系邮箱" min-width="120" />
        <el-table-column prop="expected" label="玩法说明" min-width="200" />
        <el-table-column prop="create_time" label="最后提交时间" min-width="150" />
      </el-table>
      <div class="block">
        <el-pagination
          :page-sizes="[20, 40, 60, 80]"
          :page-size="tableFrom.limit"
          :current-page="tableFrom.page"
          layout="total, sizes, prev, pager, next, jumper"
          :total="tableData.total"
          @size-change="handleSizeChange"
          @current-change="pageChange"
        />
      </div>
    </el-card>
  </div>
</template>

<script>
import {
  talentListApi,
} from "@/api/user";
export default {
  name: "Classify",
  data() {
    return {
      tableData: {
        data: [],
        total: 0
      },
      tableFrom: {
        page: 1,
        limit: 20,
        keyword: ""
      },
      listLoading: true
    };
  },
  mounted() {
    this.getList();
  },
  methods: {
    // 列表
    getList() {
      this.listLoading = true;
      talentListApi(this.tableFrom)
        .then(res => {
          this.tableData.data = res.data.list;
          this.tableData.total = res.data.count;
          this.listLoading = false;
        })
        .catch(res => {
          this.listLoading = false;
          this.$message.error(res.message);
        });
    },
    pageChange(page) {
      this.tableFrom.page = page;
      this.getList();
    },
    handleSizeChange(val) {
      this.tableFrom.limit = val;
      this.getList();
    }
  }
};
</script>

<style scoped lang="stylus"></style>
